<link href="<?php echo Yii::app()->theme->baseUrl; ?>/css/details.css" rel="stylesheet">
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl?>/js/index.js"></script>
<div class="left">
    <p class="title"><?php echo $details->article_title;?></p>
    <div class="box content">
        <?php echo $details->article_content;?>
    </div>
    <div class="box other">
        <span><i class="icon-calendar"></i><span class="text" title="发表于 2014-11-11 11:11:11"><?php echo $details->article_date;?></span></span>
        &nbsp;&nbsp;<span><i class="icon-list"></i><span class="text"><?php echo $details->article_nav; ?></span></span>
        &nbsp;&nbsp;<span><i class="icon-comment"></i><span class="text"><?php echo $commentCount;?>条评论</span></span>
        &nbsp;&nbsp;<span><i class="icon-eye-open"></i><span class="text" title="已有 <?php echo $details->article_count; ?> 人浏览"><?php echo $details->article_count;?></span></span>
    </div>
    <div class="box tag">
        <?php foreach($tags as $k=>$v):?>
        <span class="label label-success"><a href=""><?php echo $v->tag_name;?></a></span>
        <?php endforeach; ?>
    </div>
    <div class="box similar">
        <h3>你可能还喜欢</h3>
        <?php foreach($mayLikeArticle as $key=>$val): ?>
        <dl>
            <dt><a href="<?php echo $this->createUrl('article/details', array('id'=>$val->id)); ?>"><img src="<?php echo $val->article_thumbnail;?>"></a></dt>
            <dd><a href="<?php echo $this->createUrl('article/details', array('id'=>$val->id)); ?>"><?php echo $val->article_title ?></a></dd>
        </dl>
        <?php endforeach; ?>
    </div>
    <br/><br/>
    <p class="title">文章评论 <?php echo $commentCount;?> 条</p>
    <?php if($comments): ?>
    <?php foreach($comments as $key=>$val):?>
    <div class="box comment">
        <div class="info">
            <span class="face"><img src="<?php echo Yii::app()->theme->baseUrl ?>/img/face.gif" alt=""/></span>
            <span class="other"><i class="icon-user"></i> <?php echo $val->comment_user;?></span>
            &nbsp;&nbsp;<span class="other"><i class="icon-calendar"></i> <?php echo $val->comment_date;?></span>
        </div>
        <div class="comment-content">
            <?php echo $val->comment_content;?>
        </div>
    </div>
    <?php endforeach;?>
    <?php else: ?>
    <div class="box comment" style="text-align:center;">
        过来抢沙发吧～
    </div>
    <?php endif; ?>
    <br/><br/>
    <p class="title">我要评论</p>
    <input type="hidden" id="commentAction" value="<?php echo $this->createUrl('article/postComment') ?>"/>
    <div class="box post-comment">
        <?php $form=$this->beginWidget('BActiveForm', array(
            'id'=>'comment-form',
            'action'=>$this->createUrl('article/postComment'),
            'enableClientValidation'=>true,
            'enableAjaxValidation'=>true,
            'clientOptions'=>array(
                'validateOnSubmit'=>true,
                'afterValidate'=>'js:function(form, data, hasError) {
                    if(!hasError) {
                        $.ajax({
                            "type":"POST",
                            "url":$(form).attr("action"),
                            "data":$(form).serialize(),
                            "success":function(result)
                            {
                                if(result == 1)
                                {
                                    alert("评论成功");
                                    window.location.reload();
                                }
                                else
                                {
                                    alert("评论失败");
                                }
                            },
                        });
                    }
                }'
            ),
        )); ?>
        <div class="control-group">
            <label class="control-label" for="inputEmail">您的昵称</label>
            <div class="controls">
                <?php echo $form->textField($commentModel, 'comment_user', array('placeholder'=>'昵称不超过10位', 'class'=>'text')); ?>
                <?php echo $form->error($commentModel,'comment_user'); ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputPassword">您的邮箱</label>
            <div class="controls">
                <?php echo $form->textField($commentModel, 'comment_email', array('placeholder'=>'填写合法邮箱', 'class'=>'text')); ?>
                <?php echo $form->error($commentModel,'comment_email'); ?>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputText">内容</label>
            <div class="controls">
                <?php echo $form->textArea($commentModel, 'comment_content', array('placeholder'=>'填写内容不超过255位', 'class'=>'text', 'cols'=>30, 'rows'=>10)); ?>
                <?php echo $form->error($commentModel,'comment_content'); ?>
            </div>
        </div>
        <?php echo $form->hiddenField($commentModel, 'article_id', array('type'=>'hidden', 'value'=>$details->id)); ?>
        <div class="control-group">
            <div class="controls">
                <input type="submit" name="send" value="提　交" class="btn btn-primary"/>
            </div>
        </div>
        <?php $this->endWidget(); ?>

    </div>
</div>
<div class="right">
    <div class="time">
        <h3>时光隧道</h3>
        <img class="avatar" src="<?php echo Yii::app()->theme->baseUrl?>/img/duola.jpg" width="80" height="80"/>
        <div class="des">
            <p style="font-size:20px;font-weight:bold">肖永标</p>
            <p>已经发表文章：<span class="special">20</span> 篇</p>
            <p><span class="special">肖永标博客</span> 已经上线运行 <span class="special">20</span> 天</p>
        </div>
    </div>
    <div class="history">
        <h3>历史上的今天发表的文章</h3>
        <ul>
            <li>2012 年：<a href="">浅谈WINDOWS8</a></li>
            <li>2012 年：<a href="">浅谈WINDOWS8</a></li>
            <li>2012 年：<a href="">浅谈WINDOWS8</a></li>
            <li>2012 年：<a href="">浅谈WINDOWS8</a></li>
        </ul>
    </div>
    <div class="random">
        <h3>随机图文</h3>
        <div class="content-pic-list">
            <?php foreach($randList as $key=>$val) :?>
                <dl>
                    <dt><img width="75" height="75" src="<?php echo $val->article_thumbnail;?>"></dt>
                    <dd class="title"><a href=""><?php echo BlogTool::cutText($val->article_title, 13);?></a></dd>
                    <dd><?php echo  BlogTool::cutText($val->article_summary, 13);?></dd>
                    <dd><?php echo $val->article_date;?></dd>
                </dl>
            <?php endforeach;?>
        </div>
    </div>
</div>
</div>